package com.yowasa.xiuxian.entity.bo.battle;

import com.google.common.collect.Maps;
import com.yowasa.xiuxian.entity.bo.user.UserBO;
import com.yowasa.xiuxian.entity.bo.user.UserBattle;
import com.yowasa.xiuxian.util.RandomUtil;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.util.Map;
import java.util.Set;

@Data
public class UserBattleContent {
    //发起人
    private UserBO userBO;

    //buff后的最终战斗状态
    private TempUserBattle battleInfo;

    //从用户属性中复制过来的战斗状态 战斗时战斗状态
    private TempUserBattle tempBattleInfo;

    //策略列表
    private Set<String> battleStrategyList;

    //进度位置
    private int index;

    //自己行动的轮次
    private int turn = 0;

    //标识
    private Map<String, Object> flag = Maps.newHashMap();
    //状态
    private Map<String, BuffContent> buff = Maps.newHashMap();
    //技能cd
    private Map<String, Integer> cd = Maps.newHashMap();



    public static UserBattleContent build(UserBO userBO) {
        UserBattleContent userBattleContent = new UserBattleContent();
        userBattleContent.setUserBO(userBO);
        userBattleContent.setIndex(RandomUtil.randomInt(100));
        UserBattle userBattle = userBO.getUserBattle();
        TempUserBattle temp = new TempUserBattle();
        BeanUtils.copyProperties(userBattle, temp);
        userBattleContent.setTempBattleInfo(temp);
        userBattleContent.setBattleInfo(temp);
        userBattleContent.setBattleStrategyList(userBO.getUserConfig().getBattleStrategyList());
        return userBattleContent;
    }

}
